Linking Modeless Dialogs

Description

The following script demonstrates usage of the {linked=} command which is designed to create external dependencies between separate Xdialogs. Change a shared variable in one dialog, and not only do the variables refresh for the Xdialog with focus, but they also change in the linked Xdialog. The linked command is not directional -- i.e. which Xdialog has the linked command makes no difference -- theonly requirement is that the linked to Xdialog exist before the linked from Xdialog 'is created. This is "Dialog1". Any shared variables that are changed in this dialog are immediately seen by "Dialog2". Similarly, any variables that are changed in "Dialog2" are immediately seen by this dialog.

ui_modeless_dlg_box("Dialog1",<<%dlg%
{position=1,1}
{can_exit=close}
{wrap=150}
{lf};
Variable X [.20x] <Set Variable!setVar>;
<Close>;
%dlg%,<<%code%
if a_dlg_button = "Close" then
        a_dlg_button = ""
        ui_modeless_dlg_close("Dialog1")
else if a_dlg_button = "SetVar" then
        a_dlg_button = ""
    x = "Dialog1"
end if
%code%)

The following is "Dialog2". Any variables that are changed in this dialog are immediately seen by "Dialog1". Similarly, any variables that are changed in "Dialog1" are immediately seen by this dialog. The command that links the two dialogs together is the {linked=dialogname} command. This command is placed in the definition of "Dialog2" because it is launched after "Dialog1". It is not necessary to place any linking command in the definition of "Dialog1".

ui_modeless_dlg_box("Dialog2",<<%dlg%
{can_exit=close}
{position=4,4}
{linked=Dialog1}
{wrap=150}
{lf};
Variable X [.20x] <Set Variable!setVar>;
<Close>;
%dlg%,<<%code%
if a_dlg_button = "close" then
        a_dlg_button = ""
        ui_modeless_dlg_close("Dialog2")
else if a_dlg_button = "Setvar" then
        a_dlg_button = ""
    x = "Dialog2"
end if
%code%)

Limitations

Desktop applications only

See Also